<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;

Route::get('think', function () {
    return 'hello,ThinkPHP6!';
});
// require_once('./admin.php');

Route::get('hello/:name', 'index/hello');
Route::get('json', 'index/json');
Route::get('cms/nav', 'api.cms.nav/index');
Route::get('cms/bottom_nav', 'api.cms.nav/bottom');
Route::get('cms/home/slide', 'api.cms.home/slide');
Route::get('cms/home/banner', 'api.cms.home/banner');
Route::get('cms/article/:id', 'api.cms.article/single');
Route::get('cms/category/:id', 'api.cms.category/info');
Route::get('cms/category_bro/:category_id', 'api.cms.category/bro');
Route::get('cms/category_article/:category_id', 'api.cms.category/article');
Route::get('yyjk/home/hyyy', 'yyjk.home/hyyy');
Route::get('yyjk/home/chanpin', 'yyjk.home/chanpin');
Route::get('yyjk/setting', 'yyjk.setting/index');

Route::get('pc/diy/home', 'api.diy.pc/home');
// 管理后台（controller/admin下）也可以不用路由
// 例如：http://sm.tp6.com/admin.user/login
// http://sm.tp6.com/命名空间.控制器/方法

Route::domain('admin', function () {
    // Route::rule('hello/:name','hello');
})->middleware('AdminAuth');


// 前端路由开始
Route::group('api', function () {
    Route::get('/home.home', 'api.home/home');
    Route::get('/home.contact', 'api.home/contact');
    Route::get('/home.init_setting', 'api.home/init_setting');
    Route::get('/home.setting', 'api.home/setting');
    Route::get('/banner.index', 'api.banner/index');
    Route::get('/diy.index.home', 'api.diy.index/home');
    Route::get('/member.xcx.login', 'api.member.xcx/login');
    Route::post('/member.xcx.register', 'api.member.xcx/register');
    Route::get('/member.xcx.getCustomer', 'api.member.xcx/getCustomer');
    Route::get('/member.xcx.myQrcode', 'api.member.xcx/myQrcode3');
    Route::post('/member.xcx.uploadAvatar', 'api.member.xcx/uploadAvatar');
    Route::get('/checkout.order.info', 'api.checkout.order/info')->middleware( app\middleware\CustomerAuth::class );
    Route::get('/checkout.order.get_list', 'api.checkout.order/get_list')->middleware( app\middleware\CustomerAuth::class );
    Route::get('/checkout.order.pindan_list', 'api.checkout.order/pindan_list')->middleware( app\middleware\CustomerAuth::class );
    Route::post('/checkout.order.create_by_xcx', 'api.checkout.order/create_by_xcx')->middleware( app\middleware\CustomerAuth::class );
    Route::get('/checkout.order.receive', 'api.checkout.order/receive')->middleware( app\middleware\CustomerAuth::class );
    Route::get('/checkout.order.cancel', 'api.checkout.order/cancel')->middleware( app\middleware\CustomerAuth::class );
    Route::get('/checkout.checkout.index', 'api.checkout.checkout/index')->middleware( app\middleware\CustomerAuth::class );
    Route::get('/checkout.xpay.index_xcx', 'api.checkout.xpay/index_xcx')->middleware( app\middleware\CustomerAuth::class );
    Route::get('/checkout.xpay.pay_notify', 'api.checkout.xpay/pay_notify')->middleware( app\middleware\CustomerAuth::class );
    Route::get('/category.tree', 'api.category/tree');
    Route::get('/brand.index', 'api.brand/index');
    Route::get('/goods.index', 'api.goods/index');
    Route::get('/goods.info', 'api.goods/info');
    Route::get('/goods.comment', 'api.goods/comment');
    Route::get('/goods.specification', 'api.goods/specification');
    Route::get('/cart.index', 'api.cart/index')->middleware( app\middleware\CustomerAuth::class );
    Route::get('/cart.add', 'api.cart/add')->middleware( app\middleware\CustomerAuth::class );
    Route::get('/cart.calculate', 'api.cart/calculate')->middleware( app\middleware\CustomerAuth::class );
    Route::get('/cart.change', 'api.cart/change')->middleware( app\middleware\CustomerAuth::class );
    Route::get('/address.get_list', 'api.address/get_list')->middleware( app\middleware\CustomerAuth::class );
    Route::get('/address.single', 'api.address/single')->middleware( app\middleware\CustomerAuth::class );
    Route::post('/address.edit', 'api.address/edit')->middleware( app\middleware\CustomerAuth::class );
    Route::post('/address.remove', 'api.address/remove')->middleware( app\middleware\CustomerAuth::class );
    Route::get('/pickup.get_list', 'api.pickup/get_list')->middleware( app\middleware\CustomerAuth::class );
    
    Route::get('/recommend.home_category', 'api.recommend/home_category');
    Route::get('/recommend.index', 'api.recommend/index');
    // 微信支付回调url
    // Route::any('/wechat.pay.notify', 'api.wechat.pay/notify');
    Route::any('/wechat.pay.notify', 'api.checkout.xpay/wechat_pay_notify');
    Route::any('/wechat.pay.notify/i/:i', 'api.checkout.xpay/wechat_pay_notify');

    Route::get('/cms.article.single/:id', 'api.cms.article/single');
});



